package com.tianji.learning.controller;

import com.tianji.api.client.search.SearchClient;
import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.domain.vo.QuestionVO;
import com.tianji.learning.service.IInteractionQuestionService;
import com.tianji.learning.service.impl.InteractionQuestionServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "管理端问题管理")
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService questionService;



    /**
     * 管理端分页查询互动问题
     * @param pageQuery
     * @return
     */
    @GetMapping("page")
    @ApiOperation("管理端分页查询互动问题")
    public PageDTO<QuestionAdminVO> queryQuestionPage(QuestionAdminPageQuery pageQuery) {
        return questionService.queryQuestionPageOfAdmin(pageQuery);
    }

    /**
     * 管理端修改互动问题隐藏状态
     * @param id
     * @param hidden
     */
    @GetMapping("/{id}/hidden/{hidden}")
    @ApiOperation("修改互动问题隐藏状态")
    public void updateHidden(@PathVariable Long id, @PathVariable Boolean hidden) {
        questionService.updateHidden(id,hidden);
    }

    /**
     * 管理端查询互动问题详情
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    @ApiOperation("管理端查询互动问题详情")
    public QuestionAdminVO getQuestionById(@PathVariable Long id) {
        return questionService.getQuestionInfoById(id);
    }


}
